package com.tenentia.pcmps.swm.business.implementation;

import org.apache.log4j.Logger;

import com.tenentia.pcmps.swm.business.BusinessLogicException;
import com.tenentia.pcmps.swm.business.interfaces.BonusManager;
import com.tenentia.pcmps.swm.data.DataAccessObjectsFactory;
import com.tenentia.pcmps.swm.data.beans.Bonus;
import com.tenentia.pcmps.swm.data.interfaces.BonusDAO;

/**
 * 
 * @author tEnEntia, S.L.N.E.
 * 
 */
public class BonusManagerImpl implements BonusManager {

	private static final Logger LOGGER = Logger.getLogger(PersonsManagerImpl.class.getPackage().getName());
	
	public BonusManagerImpl() {
		super();
	}

	@Override
	public Bonus getBonusByAge(Bonus bonus) throws BusinessLogicException {
		
		BonusDAO bonusDAO;
		try {
			bonusDAO = (BonusDAO) DataAccessObjectsFactory.getInstance().createNewDataAccessObject(DataAccessObjectsFactory.BONUS_DAO);
			return bonusDAO.getBonusByAge(bonus);
		} catch (Exception e) {
			LOGGER.error(e, e);
			throw new BusinessLogicException(e);
		}
		
		
	}

}
